package com.h2cloud.T.TypeConverter.support;

import com.h2cloud.T.TypeConverter.converter.GenericConverter;

import java.util.Collections;
import java.util.Set;

/**
 * @Package: com.h2cloud.T.TypeConverter
 * @ClassName: StringToBooleanConverter
 * @Author: h2cloud
 * @CreateTime: 2022/6/18 8:29 下午
 * @Description:
 */
public class StringToBooleanConverter implements GenericConverter {
	@Override
	public Set<ConvertiblePair> getConvertibleTypes() {
		return Collections.singleton(new ConvertiblePair(String.class, Boolean.class));
	}

	@Override
	public Object convert(Object source, Class sourceType, Class targetType) {
		return Boolean.valueOf((String) source);
	}
}
